import { requireApiModules } from '@/utils/helper';

const modules = requireApiModules();

//只考虑一层目录且返回对象的modules
function filter(modules) {
  let result = {};
  Object.keys(modules).forEach(k => {
    const item = modules[k];
    if (item && typeof item === 'object' && !(item instanceof Array)) {
      result = {
        ...result,
        ...item,
      };
    }
  });
  return result;
}

export default {
  ...filter(modules),
};
